package com.seven.Bean;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.*;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "person")
@Data
@Validated
public class Person {
    @NotNull

    @Length(min = 1,max = 12,message = "请输入6~12位用户名")
    private String userName;
    @Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$",message = "至少8个字符，至少1个大写字母，1个小写字母和1个数字,不能包含特殊字符（非数字字母）：")
    private String password;
    @AssertTrue
    private Boolean boss;
    @Max(value = 260,message = "提示信息：年龄不符合规范")
    private Integer age;
    private Date birthday;

    private Map<String,Object> map;
    private List<Object> list;
    private Dog dog;
}
